package com.example.sellersale.controller;

import com.example.sellersale.entity.*;
import com.example.sellersale.server.*;
import com.example.sellersale.server.BillService;
import com.example.sellersale.server.CartService;
import com.example.sellersale.server.GoodsService;
import com.example.sellersale.server.GoodsTypeService;
import com.example.sellersale.server.OrderService;
import com.example.sellersale.server.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.ArrayList;
import java.util.List;

@RestController
@CrossOrigin
public class UserController {
    @Autowired
    private UserService userService;
    /**
     * 实现登录功能======登录
     * @param user
     * @return
     */
    @GetMapping("/loginL")
    public User Login(User user){
        return userService.login(user);
    }


    /**
     * 实现注册功能=====注册
     * @param user
     * @return 新注册的用户个人信息
     */
    @PostMapping("/register")
    public User register(User user){
        System.out.println("新增的用户："+user);
        return userService.register(user);
    }
    //获取所有的用户信息
    @GetMapping("/allUser")
    public List<User> allUser(){
        return userService.allUser();
    }


}
